﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using ProjectManagement.Domain.AutoMappings;
using ProjectManagement.Domain.Entities;
using NHibernate.Linq;

namespace ProjectManagement.Domain.Services
{
	public class ProvienceService
	{
		private ISessionFactory factory = NHibernateHelper.CreateSessionFactory();
		public IEnumerable<Provience> QueryAll()
		{
			using (var session = factory.OpenSession())
			{
				return session.Query<Provience>()
					.ToList();
			}
		}
		public Provience GetProvienceById(int id)
		{
			var session = factory.OpenSession();
			return session.Query<Provience>()
				.Where(p => p.ID == id).First();
		}
	}
}
